<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<script>
		window.onload= function () {
			del = document.getElementsByClassName('del');

			for (var i = 0; i < del.length; i++) {
				// del[i].index = i;
				// console.log(del);
				del[i].onclick = function () {
					// console.log(this.index)
					// this.parentNode.style.display="none";
					this.previousSibling.previousSibling.innerHTML = "";
				}
			}
		}
	</script>
</head>
<body>
	<table border="1">
		<tr>
			<td>姓名</td>
			<td>年龄</td>
			<td>操作</td>
		</tr>
		<tr>
			<td>小明</td>
			<td>20</td>
			<td class="del">删除</td>
		</tr>
		<tr>
			<td>小花</td>
			<td>20</td>
			<td class="del">删除</td>
		</tr>
		<tr>
			<td>小森</td>
			<td>20</td>
			<td class="del">删除</td>
		</tr>
		<tr>
			<td>小陈</td>
			<td>20</td>
			<td class="del">删除</td>
		</tr>	
	</table>
</body>
</html>